package com.yss.activemq_demo.controller;

import com.yss.activemq_demo.util.ActiveMqProducer;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.jms.core.JmsMessagingTemplate;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestParam;
import org.springframework.web.bind.annotation.RestController;

import javax.jms.Topic;

/**
 * @ClassName 消息发送控制器
 * @Description TODO
 * @Author lisongfeng
 * @Date 2019/5/14 18:40
 **/
@RestController
@RequestMapping("/activemq")
public class ActiveMqController {

    @Autowired
    private ActiveMqProducer activeMqProducer;

    @Autowired
    private Topic topic;

    @RequestMapping("/topic")
    public String handlerActiveMq(@RequestParam("msg")String msg) {
        activeMqProducer.sendMessage(topic, msg);
        return "ok";
    }
}
